
package mytomcat.util;

import mytomcat.dto.XmlNodeInfo;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <ul>
 * <li>Title: -XmlNodeUtil</li>
 * <li>Description: TODO </li>
 * <li>Copyright: Copyright (c) 2018</li>
 * <li>Company: /</li>
 * </ul>
 *
 * @author swc
 * @version V1.0
 * @date 2020/5/29 0029 下午 14:15
 */
public class XmlNodeUtil {

//    public static XmlNodeInfo getValue(Map<String,XmlNodeInfo> xmlNodeMap, String key, HashMap<String, String> keys) {
//        Pattern pattern =Pattern.compile("\\{\\{[id\\d]{3,5}\\}\\}");
//        Matcher matcher = pattern.matcher(key);
//        String keyValue ="";
//
//        while (matcher.find()){
//            keyValue =keys.containsKey(matcher.group())?":"+keys.get(matcher.group()):"";
//            key = key.replace(matcher.group(), keyValue);
//        }
//        return xmlNodeMap.get(key);
//    }

    public static XmlNodeInfo getValue(Map<String,XmlNodeInfo> xmlNodeMap, String parentNodeName,String key,int local) {
        return xmlNodeMap.get(parentNodeName+key+local);
    }
}
